<template>
  <div>
    <header>
      <BaseNavBar title="公告" isNav="true" />
    </header>
    <main style="margin-top: 8px;" v-if="dataSource.length > 0">
      <van-cell-group inset  style="margin-top: 8px;" v-for="item in dataSource" :key="item?.id"  >
        <van-cell :title="item?.title" :value="item?.createTime"  size="large">
          <template #label>
            <p class="van-multi-ellipsis--l3">{{ item?.content }}</p>
          </template>
        </van-cell>
      </van-cell-group>
    </main>
    <van-empty image="error" v-if="!dataSource.length" description="暂无公告" />
    <section style="height: 80px;"></section>
  </div>
</template>

<script setup>
import BaseNavBar from '@/components/BaseNavBar/index.vue'
import { ref,onMounted} from 'vue';
import {getNoticeList} from '@/apis/notice'

const dataSource = ref([]);


const init = async () => {
  const {data=[]} = await getNoticeList();
  dataSource.value = data?.list;

};

onMounted(() => {
  init()
});
</script>

<style lang="less" scoped>

</style>
